The Subreport Object

A SubreportObject object is another report inside the original report. Once you have obtained a SubreportObject, you can work with any aspect of it just as if it were a standard Report object.

You can obtain a SubreportObject through the ReportObjects collection. The following example shows you how to iterate through the sections of a report and change the background color of each subreport to magenta.

Dim Report As New CrystalReport1
Dim subReport As SubreportObject
Dim sect As Section
Dim rptObject As Object For Each sect In Report.Sections     For Each rptObject In sect.ReportObjects         If rptObject.Kind = crSubreportObject Then             Set subReport = rptObject
            subReport.BackColor = RGB(255, 0, 255)
            Set subReport = Nothing         End If     Next Next

Note:    Currently, the Crystal Report Designer Component does not support subreports inside of subreports. The report iterations cannot go more than one subreport deep. However, you can have multiple subreports inside the main report.



Seagate Software IMG Holdings, Inc.
http://www.seagatesoftware.com
Support services:
http://support.seagatesoftware.com